package chapter1109;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Email {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String email = sc.next();

        //email regex from https://javaforall.cn/124880.html
        String regex = "(^[A-Za-z0-9\\u4e00-\\u9fa5]+)@[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]++$";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(email);

        if(matcher.find()) {
            System.out.println("email vaild");
//            System.out.println(matcher.group(1));
//            System.out.println(email.substring(matcher.start(1), matcher.end(1)));
            System.out.println("User name:" + email.substring(0,email.indexOf('@')));
        }else{
            System.out.println("email not vaild");
        }

    }
}
